package com.windowes.weichang.component.redis;

import com.windowes.weichang.dto.WDistrictDto;
import com.windowes.weichang.pojo.WUser;
import redis.clients.jedis.JedisPubSub;

import java.util.List;

/***
 *
 * @author: yangqing
 * @email: qing.yang@bangdao-tech.com
 * @createTime: 2018/5/23 下午9:47
 * @description:
 *
 **/
public interface RedisService {

    boolean deleteByKey(String key);

    String set(String key, String value);

    String setEx(String key, String value);

    String get(String key);

    <T> boolean exists(KeyPrefix prefix, String key);

    boolean exists(String key);

    boolean delete(KeyPrefix prefix, String key);

    <T> Long incr(KeyPrefix prefix, String key);

    <T> Long decr(KeyPrefix prefix, String key);

    boolean delete(KeyPrefix prefix);

    List<String> scanKeys(String key);

    void setUser(String token, WUser user);

    WUser getUser(String token);

    List<WDistrictDto> getDistrict(Integer id);

    void setDistrict(Integer id, List<WDistrictDto> districts);

    void saveExpxKeyCache(String k, String v, long time);

    void subscribe(JedisPubSub jedisPubSub, String... channels);
}
